The files in this directory are as follows:

Main dataset.

1. "ONSCars.Rdata" - an R dataset containing the data used in the paper.

The following files are programs

2. "1.Hedonic.Jacknife.R"
3. "2.CES.Estimation.R"
4. "3.Results.R"
5. "squared.loss.R" 
6. "weighted.Squared.loss.R" 
7. "add.up.R"

=============

SOFTWARE REQUIREMENTS

R version 4.0.2 

Packages used: 

	lpSolve (5.6.15)
	foreign (0.8-80)
	MASS (7.3-53)
	Matrix (1.2-18)
	Rsolnp (1.16)
	lubridate (1.7.9.2)

=============

DESCRIPTION OF PROGRAMS

- 1.Hedonic.Jacknife.R

This program estimates the Hedonic regressions and then does the leave-one-out Jacknife to estimate sampling variation. It takes the dataset "ONSCars.Rdata" as an input and outputs the results as another R dataset. It must be run three times: once for each definition of the products (K=36, K=171, K=353). The resulting dataset on each run is called "results*.Rdata" were * is one of {36,171,353}.

- 2.CES.Estimation.R

This program estimates the CES parameters reported in Table 3 in Appendix C. It must be run three times; once for K=36, for K=171 and K=353. The estimates are printed to the R console.

- 3.Results.R

This program produces the main results in the paper. It produces all of the figures in the text and appendices as pdf files.

- squared.loss.R. 		An R script defining a loss function called in 1.Hedonic.Jacknife.R.

- weighted.Squared.loss.R. 	An R script defining a loss function called in 1.Hedonic.Jacknife.R.

- add.up.R. 			An R script defining constraint  called in 1.Hedonic.Jacknife.R.
=============

INSTRUCTIONS TO REPLICATORS


Install the R libraries listed above.
Set the working directory ("setwd()" in R to the locations where you have stored the files and want the outputs saved.
The empirical work was performed on MacOS 10.15.7. This uses the "quartz()" command to start a graphics device driver for the macOS system. Windows users should replace these lines with windows(). Linux users will be able to figure out what they need to do.

1. Run "1.Hedonic.Jacknife.R." Products are defined in lines 87-106. The program must be run once for K=36, once for K=171 and finally for K=353. The results of each run are stored in "results36.Rdata", "results171.Rdata" and "results353.Rdata" respectively. To run for K=36 comment out lines 90-106. To run for K=171 comment out lines 99-106. To run for K=353 leave all the lines un-commented.

2. Run "2.CES.Estimation.R". This will produce the estimates reported in Appendix C Table 3. They are printed to the R console and can be transcribed from there. As before, this program must be run three times, each one corresponding to a definition of the products. The lines which pick up the correct dataset (produced by "1.Hedonic.Jacknife.R" above are 32-34. To estimate the model for K=36, comment out lines 33-34. To estimate the model for K=171 comment out lines 34. To estimate the model for K=353 leave all the lines un-commented.

3. Run "3.Results.R". this produces all of the Figures reported in the paper.

	Figure_1a.pdf  	line 30
	Figure_1b.pdf	line 49
	Figure_2a.pdf	line 705	
	Figure_2b.pdf	line 746
	Figure_3.pdf	line 413
	Figure_4.pdf	line 583
	Figure_5.pdf	line 1056
	Figure_6.pdf	line 317
	Figure_7.pdf	line 511
	Figure_8.pdf	line 796
	Figure_9.pdf	line 859
	Figure_10.pdf	line 924
	Figure_11.pdf	line 954
